package server

import (
	"account/configs"
	"account/drivers"
	"account/models"
)

/**
  数据库迁移使用
*/
func AutoMigrate() {
	if configs.DBSelectNodeOrCluster() {
		// 集群迁移
		drivers.SqlClusterDb.AutoMigrate(&models.Account{})
		drivers.SqlClusterDb.AutoMigrate(&models.Exchange{})
		drivers.SqlClusterDb.AutoMigrate(&models.Market{})
	} else {
		// 单节点迁移
		drivers.MysqlDb.AutoMigrate(&models.Account{})
		drivers.MysqlDb.AutoMigrate(&models.Exchange{})
		drivers.MysqlDb.AutoMigrate(&models.Market{})
	}

}
